import Vue from 'vue';
import Vuex from 'vuex';
Vue.use(Vuex)
import userModule from './modules/user';
import tabsBar from './modules/tabs';

const store = new Vuex.Store({
  state: {
    isCollapse: false
  },
  getters: {
    sidebarWidth: state => state.isCollapse ? '65px' : '200px'
  },
  mutations: {
    /**
     * 切换侧边栏展开与收缩
     * @param {*} state 
     */
    TOGGLE_SIDEBAR(state) {
      state.isCollapse = !state.isCollapse
    }
  },
  modules: {
    userModule,
    tabsBar
  }
})
export default store